#include <cstdio>
#include <map>

typedef long long ll;
const int N = 1e4 + 5;
int n, a[N];
std::map<int, bool> fac[N];

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("square.in", "r", stdin);
  freopen("square.out", "w", stdout);
#endif
#endif

  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    for (int j = 2; j * j <= a[i]; ++j) {
      if (a[i] % j == 0) {
        while (a[i] % j == 0) { fac[i][j] ^= 1; }
      }
    }
    if (a[i] != 1) fac[i][a[i]] ^= 1;
  }
  ll ans = 0;
  for (int i = 1; i <= n; ++i) {
    fac[n + 1].clear();
    for (int j = i; j <= n; ++j) {
      for (std::map<int, bool>::iterator iter = fac[j].begin();
           iter != fac[j].end(); ++iter) {
        fac[n + 1][iter->first] ^= iter->second;
      }
      bool flag = true;
      for (std::map<int, bool>::iterator iter = fac[n + 1].begin();
           iter != fac[n + 1].end(); ++iter) {
        if (fac[n + 1][iter->first]) {
          flag = false;
          break;
        }
      }
      ans += flag;
    }
  }
  printf("%lld", ans);
  return 0;
}